package com.mz.ozy.activity.assets;

import android.os.Bundle;
import android.text.TextUtils;
import android.widget.EditText;

import com.mz.ozy.R;
import com.mz.ozy.base.BaseActivity;
import com.mz.ozy.bean.MyCardBean;
import com.mz.ozy.mvp.presenter.MyCardPresenter;
import com.mz.ozy.mvp.view.MycardContract;
import com.mz.ozy.utils.ToastUtils;

import org.json.JSONObject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ExchangeActivity extends BaseActivity<MycardContract.View, MyCardPresenter> implements MycardContract.View {
    @BindView(R.id.et_card_code)
    EditText etCardCode;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_exchange);
        ButterKnife.bind(this);
        initTitle();
        tvCenterTitle.setText("兑换卡券");
    }


    @OnClick(R.id.bt_confirm)
    public void onViewClicked() {
        String cardCdoe = etCardCode.getText().toString();
        if (TextUtils.isEmpty(cardCdoe)) {
            ToastUtils.showToast("请输入兑换码");
            return;
        }
        mPresenter.upAccount(this, cardCdoe);
    }

    @Override
    public void getInfoSuccess(MyCardBean bean) {

    }

    @Override
    public void getAccountSuccess(JSONObject bean) {
        ToastUtils.showToast("兑换成功");
        finish();
    }
}
